import wx
class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title='My Frame')
        panel = wx.Panel(self)
        label1 = wx.StaticText(panel, wx.ID_ANY, 'First name:')
        label2 = wx.StaticText(panel, wx.ID_ANY, 'Last name:')
        self.text1 = wx.TextCtrl(panel, wx.ID_ANY)
        self.text2 = wx.TextCtrl(panel, wx.ID_ANY)
        button = wx.Button(panel, wx.ID_ANY, 'Submit')
        sizer = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5)
        self.Bind(wx.EVT_BUTTON, self.OnSubmit, button)
        sizer.Add(label1)
        sizer.Add(self.text1)
        sizer.Add(label2)
        sizer.Add(self.text2)
        sizer.Add((0,0)) #filler for the grid cell
        sizer.Add(button)
        panel.SetSizer(sizer)
        sizer.Fit(self)
    def OnSubmit(self, evt):
        wx.MessageBox('Your name is %s %s!' % \
            (self.text1.GetValue(), self.text2.GetValue()), 'Feedback')
class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame()
        self.SetTopWindow(frame)
        frame.Show()
        return True
if __name__ == '__main__':
    app = MyApp(False)
    app.MainLoop()